<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../../org/angular.min.js"></script>
</head>

<body ng-app="app" ng-controller="ctrl">
    <div>
        <!-- ng-model绑定的是select下拉框选完之后的值，不是data -->
        城市： <select ng-model="city" ng-options="v.value as v.name for v in data" name="" id="">
    <!-- 默认显示，value属性必须有，value值必须为空 -->
            <option value="">请选择城市</option>
        </select>
    </div>
    <div>
        {{city}}
    </div>
    <script>
        var m = angular.module('app', []);
        m.controller('ctrl', ['$scope', function($scope) {
            $scope.city = 'beijing';
            $scope.data = [{
                    name: '北京',
                    value: 'beijing'
                },
                {
                    name: '天津',
                    value: 'tianjing'
                },
                {
                    name: '南京',
                    value: '南京'
                },
                {
                    name: '上海',
                    value: 'shanghai'
                },
            ];
        }])
    </script>
</body>

</html>
